{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from bokeh.plotting import figure, show, output_notebook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## algorithm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def generate_maze(n, m):\n",
    "    # maze skeleton\n",
    "    maze = np.tile([[1, 2], [2, 0]], (n // 2 + 1, m // 2 + 1))\n",
    "    maze = maze[:-1, :-1]\n",
    "\n",
    "    cells = {(i, j): (i, j) for i, j in np.argwhere(maze == 1)}\n",
    "    walls = np.argwhere(maze == 2)\n",
    "\n",
    "    # union-find\n",
    "    def find(p, q):\n",
    "        if p != cells[p] or q != cells[q]:\n",
    "            cells[p], cells[q] = find(cells[p], cells[q])\n",
    "        return cells[p], cells[q]\n",
    "\n",
    "    # find spanning tree\n",
    "    np.random.shuffle(walls)\n",
    "    for wi, wj in walls:\n",
    "        if wi % 2:\n",
    "            p, q = find((wi - 1, wj), (wi + 1, wj))\n",
    "        else:\n",
    "            p, q = find((wi, wj - 1), (wi, wj + 1))\n",
    "\n",
    "        maze[wi, wj] = p != q\n",
    "        if p != q:\n",
    "            cells[p] = q\n",
    "\n",
    "    return maze"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## run"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "maze = generate_maze(40, 80)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"ef46fb0b-ffaf-4ce1-b0b6-ac8c16c5aa2a\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(global) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    window._bokeh_onload_callbacks = [];\n",
       "    window._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    window._bokeh_timeout = Date.now() + 5000;\n",
       "    window._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (window.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"ef46fb0b-ffaf-4ce1-b0b6-ac8c16c5aa2a\");\n",
       "      el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "    } else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function run_callbacks() {\n",
       "    window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    delete window._bokeh_onload_callbacks\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    window._bokeh_onload_callbacks.push(callback);\n",
       "    if (window._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    window._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        window._bokeh_is_loading--;\n",
       "        if (window._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"ef46fb0b-ffaf-4ce1-b0b6-ac8c16c5aa2a\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'ef46fb0b-ffaf-4ce1-b0b6-ac8c16c5aa2a' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"ef46fb0b-ffaf-4ce1-b0b6-ac8c16c5aa2a\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i](window.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!window._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      window._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"ef46fb0b-ffaf-4ce1-b0b6-ac8c16c5aa2a\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (window._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(this));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"c2e25701-fffb-49ba-b19e-d0ee3607d138\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(global) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      window._bokeh_onload_callbacks = [];\n",
       "      window._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      window._bokeh_timeout = Date.now() + 0;\n",
       "      window._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (window.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"c2e25701-fffb-49ba-b19e-d0ee3607d138\");\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      } else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "    function run_callbacks() {\n",
       "      window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      delete window._bokeh_onload_callbacks\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      window._bokeh_onload_callbacks.push(callback);\n",
       "      if (window._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      window._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          window._bokeh_is_loading--;\n",
       "          if (window._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"c2e25701-fffb-49ba-b19e-d0ee3607d138\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'c2e25701-fffb-49ba-b19e-d0ee3607d138' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"49d21500-52be-43a1-93cd-d0e59b7ba0bd\":{\"roots\":{\"references\":[{\"attributes\":{\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"f03bb244-84fd-4930-b5d7-0c46416f271b\",\"type\":\"BasicTicker\"}},\"id\":\"d839b429-4057-483b-ac7a-ec48a7f17e4c\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"ca999261-f364-4564-9113-fbf9acca6901\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"27956adb-9f66-49f0-aa3f-397e91b5fe01\",\"type\":\"Image\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"dbf12c5b-b3dd-4460-972b-ca5705609476\",\"type\":\"Image\"},\"selection_glyph\":null},\"id\":\"5fc2dd27-0220-4d29-a193-de3d4db38f38\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"b478501d-8135-4900-952e-fc2ab587761b\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"color_mapper\":{\"id\":\"3f6eacfa-05d8-4fd4-9fc7-eb49766214ff\",\"type\":\"LinearColorMapper\"},\"dh\":{\"units\":\"data\",\"value\":1},\"dw\":{\"units\":\"data\",\"value\":1},\"image\":{\"field\":\"image\"},\"x\":{\"value\":0},\"y\":{\"value\":0}},\"id\":\"27956adb-9f66-49f0-aa3f-397e91b5fe01\",\"type\":\"Image\"},{\"attributes\":{\"formatter\":{\"id\":\"1c215b09-11ba-41a1-9565-dfef11dae01f\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"bffb1a99-5be4-4b73-ba94-13f0a5385bf6\",\"type\":\"BasicTicker\"},\"visible\":false},\"id\":\"91b7c001-ff3a-4bd9-ad58-aeeb060ca840\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"bffb1a99-5be4-4b73-ba94-13f0a5385bf6\",\"type\":\"BasicTicker\"},{\"attributes\":{\"palette\":[\"#228B22\",\"#ffffff\"]},\"id\":\"3f6eacfa-05d8-4fd4-9fc7-eb49766214ff\",\"type\":\"LinearColorMapper\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"bffb1a99-5be4-4b73-ba94-13f0a5385bf6\",\"type\":\"BasicTicker\"}},\"id\":\"1ffc15a3-a05b-43d7-8f47-5b9d60eaab46\",\"type\":\"Grid\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"7e8dafbe-fd86-40ae-9bd2-5c68233af5e5\",\"type\":\"Title\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"a47049b3-c53b-4915-8b85-e07d139a45d6\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"color_mapper\":{\"id\":\"35617aa3-ddf0-4285-8297-68f6ad9b47ff\",\"type\":\"LinearColorMapper\"},\"dh\":{\"units\":\"data\",\"value\":1},\"dw\":{\"units\":\"data\",\"value\":1},\"image\":{\"field\":\"image\"},\"x\":{\"value\":0},\"y\":{\"value\":0}},\"id\":\"dbf12c5b-b3dd-4460-972b-ca5705609476\",\"type\":\"Image\"},{\"attributes\":{\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"988522c5-4f12-4a5d-82a3-ec9b14874dd2\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"0ab3d1b9-9980-410c-bf89-aab989292ca8\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"image\"],\"data\":{\"image\":[[[1,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1],[1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0],[1,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1],[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1],[1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,1,1,1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,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1],[1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,1,1],[0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1]]]}},\"id\":\"ca999261-f364-4564-9113-fbf9acca6901\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"0ab3d1b9-9980-410c-bf89-aab989292ca8\",\"type\":\"PanTool\"},{\"id\":\"988522c5-4f12-4a5d-82a3-ec9b14874dd2\",\"type\":\"WheelZoomTool\"},{\"id\":\"d10418d2-bc4e-4a19-8945-c0b61bbc96c5\",\"type\":\"BoxZoomTool\"},{\"id\":\"4001b6d6-26bd-4f82-b20a-48996b7bc6d9\",\"type\":\"SaveTool\"},{\"id\":\"2077aa1b-663d-4f57-820e-3a5f9d29a826\",\"type\":\"ResetTool\"},{\"id\":\"d6002140-2a53-41e4-bcd6-068fda016b73\",\"type\":\"HelpTool\"}]},\"id\":\"0af06f58-4c94-4ab3-8beb-c1fd772e4d75\",\"type\":\"Toolbar\"},{\"attributes\":{\"overlay\":{\"id\":\"a47049b3-c53b-4915-8b85-e07d139a45d6\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"d10418d2-bc4e-4a19-8945-c0b61bbc96c5\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"below\":[{\"id\":\"ec914024-15f5-488a-8f8a-2800b7bb6df1\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"91b7c001-ff3a-4bd9-ad58-aeeb060ca840\",\"type\":\"LinearAxis\"}],\"outline_line_color\":{\"value\":\"#ffffff\"},\"plot_height\":410,\"plot_width\":810,\"renderers\":[{\"id\":\"ec914024-15f5-488a-8f8a-2800b7bb6df1\",\"type\":\"LinearAxis\"},{\"id\":\"d839b429-4057-483b-ac7a-ec48a7f17e4c\",\"type\":\"Grid\"},{\"id\":\"91b7c001-ff3a-4bd9-ad58-aeeb060ca840\",\"type\":\"LinearAxis\"},{\"id\":\"1ffc15a3-a05b-43d7-8f47-5b9d60eaab46\",\"type\":\"Grid\"},{\"id\":\"a47049b3-c53b-4915-8b85-e07d139a45d6\",\"type\":\"BoxAnnotation\"},{\"id\":\"5fc2dd27-0220-4d29-a193-de3d4db38f38\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"7e8dafbe-fd86-40ae-9bd2-5c68233af5e5\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"d8030c47-bd15-4dc5-a88b-8a1e35f94bd4\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"0af06f58-4c94-4ab3-8beb-c1fd772e4d75\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"1a610bd0-e715-41f7-a172-7345efa9ec06\",\"type\":\"Range1d\"},\"y_range\":{\"id\":\"3b9f7aae-9eb2-4ffc-9f43-5bf81f1635cc\",\"type\":\"Range1d\"}},\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"4001b6d6-26bd-4f82-b20a-48996b7bc6d9\",\"type\":\"SaveTool\"},{\"attributes\":{\"callback\":null},\"id\":\"1a610bd0-e715-41f7-a172-7345efa9ec06\",\"type\":\"Range1d\"},{\"attributes\":{\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"d6002140-2a53-41e4-bcd6-068fda016b73\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"f03bb244-84fd-4930-b5d7-0c46416f271b\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"d8030c47-bd15-4dc5-a88b-8a1e35f94bd4\",\"type\":\"ToolEvents\"},{\"attributes\":{\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"2077aa1b-663d-4f57-820e-3a5f9d29a826\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1c215b09-11ba-41a1-9565-dfef11dae01f\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"formatter\":{\"id\":\"b478501d-8135-4900-952e-fc2ab587761b\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"f03bb244-84fd-4930-b5d7-0c46416f271b\",\"type\":\"BasicTicker\"},\"visible\":false},\"id\":\"ec914024-15f5-488a-8f8a-2800b7bb6df1\",\"type\":\"LinearAxis\"},{\"attributes\":{\"callback\":null},\"id\":\"3b9f7aae-9eb2-4ffc-9f43-5bf81f1635cc\",\"type\":\"Range1d\"},{\"attributes\":{\"palette\":[\"#228B22\",\"#ffffff\"]},\"id\":\"35617aa3-ddf0-4285-8297-68f6ad9b47ff\",\"type\":\"LinearColorMapper\"}],\"root_ids\":[\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.5\"}};\n",
       "            var render_items = [{\"docid\":\"49d21500-52be-43a1-93cd-d0e59b7ba0bd\",\"elementid\":\"c2e25701-fffb-49ba-b19e-d0ee3607d138\",\"modelid\":\"3a2b378f-8772-4435-aabd-42cbabd1e6e2\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i](window.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!window._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        window._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"c2e25701-fffb-49ba-b19e-d0ee3607d138\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (window._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(this));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "output_notebook()\n",
    "\n",
    "plot = figure(x_range=(0, 1), y_range=(0, 1),\n",
    "              plot_height=410, plot_width=810)\n",
    "plot.axis.visible = False\n",
    "plot.outline_line_color = '#ffffff'\n",
    "plot.image([maze], x=0, y=0, dw=1, dh=1, palette=['#228B22', '#ffffff'])\n",
    "\n",
    "show(plot)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
